#include <stdio.h>
#include <math.h>

const double PI = 3.1415926535;

int main() {
    float a, r;
    scanf("%f %f", &a, &r);

    float res = 0.0f;
    if (a > 2.0*r)
        res = PI * r * r;
    else if (r > sqrt(2.0f)/2.0f*a)
        res = a * a;
    else {
        const float h = a / 2.0f;
        float sc = r * r * acos(h/r) - h * sqrt(r*r - h*h);
        res = PI * r * r - 4 * sc;
    }

    printf("%.3f\n", res);
    return 0;
}
